package day0621;

import java.util.Arrays;

public class Test6 {


    private static void sort(int[] a) {
        for(int j=1; j<a.length ;j++) {
            for (int i = 0; i < a.length - j; i++) {
                if (a[i] < a[i + 1]) {
                    int t = a[i];
                    a[i] = a[i + 1];
                    a[i + 1] = t;
                }
            }
        }
        System.out.println(Arrays.toString(a));
    }


    public static void main(String[] args) {
        int[]  a={2, 90, 6, 1, 45};
        sort(a);

        //                [0.0    100.0)
        int[]  b={200,   9,  (int)(Math.random() *100)  ,  45};
        sort(b);




/*

        for(int i=0;  i<a.length-2; i++){
            if(a[i]<a[i+1]){
                int t=a[i];
                a[i]=a[i+1];
                a[i+1]=t;
            }
        }
        System.out.println(a[3]);////{ 90, 6,45,    2.     1};


        for(int i=0;  i<a.length-3; i++){
            if(a[i]<a[i+1]){
                int t=a[i];
                a[i]=a[i+1];
                a[i+1]=t;
            }
        }
        System.out.println(a[2]);////{ 90, 45,         6        2.     1};




        for(int i=0;  i<a.length-4; i++){
            if(a[i]<a[i+1]){
                int t=a[i];
                a[i]=a[i+1];
                a[i+1]=t;
            }
        }
        System.out.println(a[1]);
*/



    }


}
